# -*-coding = utf-8 -*-
# @Time : 2022/9/17 13:18
# @Author : Oliver
# @File : kstring.py
# @Software :PyCharm

# 字符串s，长度为k的子串
def kstring(s, k):
    substring = []
    res = ""
    for i in range(0, len(s) - k + 1):
        temp = s[i] + s[i + 1] + s[i + 2]
        substring.append(temp)

    # 浅拷贝
    sorted_substring = substring[:]
    sorted_substring.sort()

    for i in range(len(sorted_substring)):
        idx = substring.index(sorted_substring[i])
        substring[idx] = ''
        if i != len(sorted_substring) - 1:
            res += str(idx + 1) + ' '
        else:
            res += str(idx + 1)

    return res


s = input()
s = str(s)
k = input()
k = int(k)
print(kstring(s, k))

# res = kstring('baaaa', 3)
# print(res)
# res = kstring('baaaac', 3)
# print(res)
